<#import "../macro/components.ftl" as components/>
<#include "../macro/layout_default.ftl"/>

<@head>
<link rel="stylesheet" href="/misc/app/css/product_list.css"/>
</@head>

<@body>
<script src="/misc/app/js/qrcode_list.js"></script>
<script src="/misc/jquery-fileupload-9.14.0/jquery.ui.widget.js"></script>
</@body>

<@layout_default>
<div class="box">
    <div class="box-header with-border">
        <span class="pull-right text-muted">共 ${pagelist.resultTotal} 条记录</span>
        <input type="hidden" id="resultTotal_hidden" value="${pagelist.resultTotal}" />
        <form class="form-inline" action="/qrcode">
            <div class="input-group">
                <div class="input-group-addon">关键字：</div>
                <input type="text" class="form-control" style="width: 200px" name="qcname" value="${qcname!}" 
                placeholder="二维码批次"/>
            </div>
            <div class="input-group">
                <div class="input-group-addon">类型：</div>
                <select class="form-control" name="state">
                    <option value="">全部</option>
                    <option value="1" ${(state?exists && state == "1")?string("selected","")}>瓶码/盒码</option>
                    <option value="2" ${(state?exists && state == "2")?string("selected","")}>箱码</option>
                </select>
            </div>

              <div class="input-group">
                <div class="input-group-addon">打印：</div>
                <select class="form-control" name="is_print">
                    <option value="">全部</option>
                    <option value="1" ${(is_print?exists && is_print == "1")?string("selected","")}>是</option>
                    <option value="0" ${(is_print?exists && is_print == "0")?string("selected","")}>否</option>
                </select>
            </div>
            <br>
            <br>
             <div class="input-group">
                <div class="input-group-addon">总数量：</div>
                <input type="text" class="form-control" style="width: 70px" name="tsno" value="${tsno!}" 
                placeholder="小"/><input type="text" class="form-control" style="width: 70px" name="teno" value="${teno!}" 
                placeholder="大"/>
            </div>
            
             <div class="input-group">
                <div class="input-group-addon">已扫量：</div>
                <input type="text" class="form-control" style="width: 70px" name="ysno" value="${ysno!}" 
                placeholder="小"/>
                 <input type="text" class="form-control" style="width: 70px" name="yeno" value="${yeno!}" 
                placeholder="大"/>
                
            </div>
            

            <button type="submit" class="btn btn-warning"><i class="fa fa-search"></i> 查询</button>
            <button type="button" id="search_reset" class="btn btn-warning"><i class="fa "></i> 重置</button>
            <button type="button" class="btn btn-default" name="btn_new" data-toggle="modal" data-target="#md_new"><i class="fa fa-plus"></i> 生成二维码</button>
        </form>
        <form class="form-inline hide">
            <input class="form-control"/>
            <input type="email" class="form-control"/>
            <button type="submit" class="btn btn-default">Send invitation</button>
        </form>
    </div>

    <!-- /.box-header -->
    <div class="box-body">
        <table class="table table-striped table-hover">
            <tr>
                <th>ID</th>
                <th>二维码批次</th>
                <th>开始编号</th>
                <th>结束编号</th>
                <th>类型</th>
                <th>总数量</th>
                <th>绑定量</th>
                <th>已扫量</th>
                <th>生成时间</th>
                <th>操作人</th>
                  <th>是否打印</th>
                <th>操作</th>
            </tr>
            <#list pagelist.result as item>
                <tr>
                    <td>${item.id}</td>
                    <td>${item.qcname}</td>
                    <td>${item.minid!0}</td>
                    <td>${item.maxid!0}</td>
                    <td><#if item.type==1><span class="text-green">瓶码/盒码</span><#elseif item.type==2><span class="text-yellow">箱码</span><#else><span class="text-danger">未知</span></#if></td>
                    <td>${item.total!0}</td>
                    <td>${item.bd!0}</td>
                    <td>${item.scan_nub!0}</td>
                    <td>${item.c_time?number_to_datetime}</td>
                    <td>${item.c_admin!}</td>
                    <td><#if item.is_print==true><span class="text-green">是</span><#elseif item.is_print==false><span class="text-yellow">否</span><#else><span class="text-danger">未知</span></#if></td>
                    <td>
                       <button type="button" class="btn btn-default btn-xs" name="see_binding" onclick="window.location.href='/qrcode/binding?id=${item.id?c}'">绑定分布</button>
                       <button type="button" class="btn btn-default btn-xs" name="see_detail" onclick="window.location.href='/qrcode/detail?id=${item.id?c}'">明细</button>
                       <button type="button" class="btn btn-default btn-xs" data-toggle="#md_btn_down" name="btn_down" data-id="${item.id?c}" data-qcname="${item.qcname}" data-type="${item.type}" data-history="${item.is_history}" >下载</button>
                       <button type="button" class="btn btn-default btn-xs" data-toggle="#md_shortbtn_down" name="btn_shortdown" data-id="${item.id?c}" data-qcname="${item.qcname}" data-type="${item.type}" data-history="${item.is_history}" >短地址下载</button>
                       <#--<button type="button" class="btn btn-default btn-xs btn_down_image" data-toggle="#md_btn_down_image" data-id="${item.id?c}" data-qcname="${item.qcname}" data-type="${item.type}" data-history="${item.is_history}" >图片下载</button>-->
                       <#--<button type="button" class="btn btn-default btn-xs" name="btn_down" data-target="#md_btn_down" data-id="${item.id?c}" data-qcname="${item.qcname}">下载</button> -->
                    </td>
                </tr>
            </#list>
        </table>
        <table class="table table-striped table-hover">
        	<tr>
        		<td colspan="13" style="text-align:right;background-color:white;">
        			<a href="javascript:void(0);" name="btn_export"><i class="glyphicon glyphicon-save"></i> 数据导出</a>
        		</td>
        	</tr>
        </table>
    </div>
    <!-- /.box-body -->
    <div class="box-footer text-center">
       <@components.pagination "${pagelist.rquesturl}&page=$page",pagelist.page,pagelist.pageTotal/>
    </div>
</div>


<!--=========== Modals =============-->
<!-- md_new -->
<div class="modal" id="md_new" tabindex="-1">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title"><i class="fa fa-plus"></i> 生成二维码</h4>
            </div>
            <div class="modal-body">
                <form class="form-horizontal" name="form_new">
                    <div class="form-group">
                        <label class="col-sm-2 control-label"><strong class="text-red bold"> *</strong> 二维码批次</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" placeholder="二维码批次" name="qcname"/>
                        </div>
                    </div>
                     <div class="form-group">
                        <label class="col-sm-2 control-label"><strong class="text-red bold"> *</strong> 类型</label>
                        <div class="col-sm-10">
                            <select class="form-control" name="type">
                                <option value="1">瓶码/盒码</option>
                                <option value="2">箱码</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label"><strong class="text-red bold"> *</strong> 数量</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" placeholder="生成的二维码数量(一次最多100万)" name="nubs"/>
                        </div>
                    </div>
                   
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                <button type="button" id="btn_new_save_qrcode" class="btn btn-primary" name="btn_new_save_qrcode">批量生成</button>
            </div>
        </div>
    </div>
</div>

<!-- md_btn_down -->
<div class="modal" id="md_btn_down" tabindex="-1" style="display:none;">
    <div class="modal-dialog" style="width: 300px;" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalLabel"><i class="fa fa-info-circle text-yellow"></i> 提示</h4>
            </div>
            <div class="modal-body">
                <form class="form-horizontal" name="form_edit_down">
                    <input type="hidden" name="id"/>
                    <input type="hidden" name="qcname"/>
                    <div class="form-group">
                        <label class="col-sm-2 control-label" style="width:65%;">请选择盒码/瓶码下载内容：</label>
                        <div class="col-sm-5" style="padding-top:7px;padding-left: 26px;width:100%" >
			          	<input type="radio" name="isAutoDraw" id="radio_yes" value="0" runat="server" checked/>物流码&nbsp;&nbsp;&nbsp;&nbsp;
			          	<input type="radio" name="isAutoDraw" id="radio_no" value="1" runat="server"  />营销码
			       		</div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                <button type="button" class="btn btn-primary" name="btn_save_edit_down"  data-dismiss="modal" >确定</button>
            </div>
        </div>
    </div>
</div>


<!-- md_btn_down -->
<div class="modal" id="md_shortbtn_down" tabindex="-1" style="display:none;">
    <div class="modal-dialog" style="width: 300px;" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalLabel"><i class="fa fa-info-circle text-yellow"></i> 提示</h4>
            </div>
            <div class="modal-body">
                <form class="form-horizontal" name="form_shortedit_down">
                    <input type="hidden" name="id"/>
                    <input type="hidden" name="qcname"/>
                    <div class="form-group">
                        <label class="col-sm-2 control-label" style="width:65%;">请选择盒码/瓶码下载内容：</label>
                        <div class="col-sm-5" style="padding-top:7px;padding-left: 26px;width:100%" >
			          	<input type="radio" name="isAutoDraw" id="radio_yes" value="0" runat="server" checked/>物流码&nbsp;&nbsp;&nbsp;&nbsp;
			          	<input type="radio" name="isAutoDraw" id="radio_no" value="1" runat="server"  />营销码
			       		</div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                <button type="button" class="btn btn-primary" name="btn_shortsave_edit_down"  data-dismiss="modal" >确定</button>
            </div>
        </div>
    </div>
</div>


<!-- md_btn_down_image 图片下载 -->
<div class="modal" id="md_btn_down_image" tabindex="-1" style="display:none;">
    <div class="modal-dialog" style="width: 300px;" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalLabel"><i class="fa fa-info-circle text-yellow"></i> 提示</h4>
            </div>
            <div class="modal-body">
                <form class="form-horizontal" name="form_edit_down_image">
                    <input type="hidden" name="id"/>
                    <input type="hidden" name="qcname"/>
                    <div class="form-group">
                        <label class="col-sm-2 control-label" style="width:65%;">请选择盒码/瓶码下载内容：</label>
                        <div class="col-sm-5" style="padding-top:7px;padding-left: 26px;width:100%" >
                            <input type="radio" name="isAutoDraw"  value="0" runat="server" checked/>物流码&nbsp;&nbsp;&nbsp;&nbsp;
                            <input type="radio" name="isAutoDraw" value="1" runat="server"  />营销码
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                <button type="button" class="btn btn-primary" name="btn_save_edit_down_image"  data-dismiss="modal" >确定</button>
            </div>
        </div>
    </div>
</div>

</@layout_default>